<?php
/**
 * Created by PhpStorm.
 * User: 魏爷
 * Date: 2016/4/21
 * Time: 15:17
 */

namespace Home\Controller;


class BookAlianceController extends BaseController
{
    /**
     * 书友论坛
     **/
    public function bookForum(){
        $feel_title=I('feel_title');
        $getBookForumInfo=D('TipExperience')->getBookForumInfo($feel_title);
        $this->assign('_getBookForumInfo',$getBookForumInfo);
        $this->display('BookAliance/bookForum');
    }
    /**
     * 论坛讨论
    **/
    public function userForum(){
        $feel_id=I('feel_id');
        $getByIdInfo=D('Forum')->getByIdInfo($feel_id);
        $getAllUserInfo=D('UserLogin')->getAllUserInfo();
        $getBookAlianceById=D('TipExperience')->getBookAlianceById($feel_id);
        $this->assign('_getByIdInfo',$getByIdInfo);
        $this->assign('_getAllUserInfo',$getAllUserInfo);
        $this->assign('_getBookAlianceById',$getBookAlianceById);
        $this->display('BookAliance/userForum');
    }
    /**
     * 论坛讨论
    **/
    public function forumChat(){
        $feel_id=I('feel_id');
        $u_id=getUserId();
        $forum_content=I('forum_content');
        if(empty($forum_content)){
            $this->error('信息为空',null,true);
        }
        $res=D('Forum')->forumChat($feel_id,$u_id,$forum_content);
        if($res==false){
            $this->error('发表失败',null,true);
        }else{
            $this->success('发表成功',null,true);
        }
    }
    /**
     * 删除评论
    **/
    public function forumDel(){
        $forum_id=I('forum_id');
        $res=D('Forum')->forumDel($forum_id);
        if($res==false){
            $this->error('删除失败',null,true);
        }else{
            $this->success('删除成功',null,true);
        }
    }
}